<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>线性渐变</title>
    <style>
        .box{
            margin: 100px auto;
            width: 200px;
            height: 200px;
            /* 颜色朝右上方渐变 */
            background: linear-gradient(to right top, red, blue 30%, yellow 60%, green 100%);
            /* 颜色朝左下方渐变 */
            background: linear-gradient(to left bottom, red, blue 30%, yellow 60%, green);
        }
    </style>
</head>
<body>
    <div class="box"></div>
</body>
</html>